﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ArcEngine.Editor.Wizards
{
    public partial class NewLayoutWizard : Form
    {
        public NewLayoutWizard()
        {
            InitializeComponent();
        }

        /// <summary>
        /// FormClosing event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            // 
            if (DialogResult != DialogResult.OK)
                return;


            // No name selected
            if (LayoutNameBox.Text == "")
            {
                MessageBox.Show("Select a layout name first!");
                e.Cancel = true;
				return;
            }

            // Entity already exists ?
            if (ResourceManager.GetLayout(LayoutNameBox.Text) != null)
            {
                MessageBox.Show("Layout name already in use or invalid. Use another name !");
                e.Cancel = true;
				return;
            }


			ResourceManager.CreateLayout(LayoutNameBox.Text);

        }

    }
}
